package com.ethanJun.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.stereotype.Service;

import java.util.Properties;

/**
 * @author 衣立君
 * @date 2025/04/08 17:04
 **/
@Slf4j
@Service
public class McpDemoServerService {

    @Tool(description = "查询当前的主机信息")
    public String queryComputerInfo() {
        Properties props = System.getProperties();
        StringBuilder sb = new StringBuilder();

        sb.append("=== 基本系统信息 ===\n");
        sb.append("操作系统名称: ").append(props.getProperty("os.name")).append("\n");
        sb.append("操作系统架构: ").append(props.getProperty("os.arch")).append("\n");
        sb.append("操作系统版本: ").append(props.getProperty("os.version")).append("\n");
        sb.append("用户名称: ").append(props.getProperty("user.name")).append("\n");
        sb.append("用户主目录: ").append(props.getProperty("user.home")).append("\n");
        sb.append("Java版本: ").append(props.getProperty("java.version")).append("\n");
        sb.append("Java供应商: ").append(props.getProperty("java.vendor")).append("\n");
        return sb.toString();
    }
}